package com.yfp.operation.service.impl;

import com.yfp.operation.domain.PositionSharing;
import com.yfp.operation.mapper.PositionSharingMapper;
import com.yfp.operation.service.PositionSharingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 点位分成
 *
 * @CreateDate: 2024/6/14 17:36
 * @UpdateUser:
 * @UpdateDate: 2024/6/14 17:36
 * @UpdateRemark: 暂无修改
 * @Version: 1.0
 */
@Service
@Slf4j
public class PositionSharingServiceImpl implements PositionSharingService {

    @Autowired
    private PositionSharingMapper positionSharingMapper;

    @Override
    public PositionSharing getById(Long id) {
        return positionSharingMapper.getById(id);
    }

    @Override
    public List<PositionSharing> getByPositionId(String positionId) {
        return positionSharingMapper.getByPositionId(positionId);
    }

    @Override
    @Transactional
    public void add(PositionSharing positionSharing) {
        positionSharingMapper.add(positionSharing);
    }

    @Override
    @Transactional
    public void edit(PositionSharing positionSharing) {
        positionSharingMapper.edit(positionSharing);
    }

    @Override
    @Transactional
    public void delByPositionId(String positionId) {
        positionSharingMapper.delByPositionId(positionId);
    }

    @Override
    public List<PositionSharing> selectList(List<String> machineIds) {
        return positionSharingMapper.findByMachineIds(machineIds);
    }

    @Override
    public List<PositionSharing> getByPositionIdAndUserId(String positionId, Long userId) {
        return positionSharingMapper.getByPositionIdAndUserId(positionId,userId);
    }

    @Override
    public List<PositionSharing> getByPositionIdsAndUserId(List<String> positionIds, Long userId) {
        return positionSharingMapper.getByPositionIdsAndUserId(positionIds, userId);
    }

    @Override
    public List<PositionSharing> findAll() {
        return positionSharingMapper.findAll();
    }

    @Override
    public List<PositionSharing> getByUserId(Long userId) {
        return positionSharingMapper.getByUserId(userId);
    }
}
